home *** CD-ROM | disk | FTP | other *** search
/ Languguage OS 2 / Languguage OS II Version 10-94 (Knowledge Media)(1994).ISO / gnu / recode.lha / recode-3.2.4 / lat1txte.c < prev    next >
C/C++ Source or Header  |  1992-08-19  |  7KB  |  174 lines

  1. /* Conversion of files between different charsets and usages.
  2.    Copyright (C) 1990 Free Software Foundation, Inc.
  3.    Francois Pinard <pinard@iro.umontreal.ca>, 1988.
  4.  
  5.    This program is free software; you can redistribute it and/or modify
  6.    it under the terms of the GNU General Public License as published by
  7.    the Free Software Foundation; either version 2, or (at your option)
  8.    any later version.
  9.  
  10.    This program is distributed in the hope that it will be useful, but
  11.    WITHOUT ANY WARRANTY; without even the implied warranty of
  12.    MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
  13.    General Public License for more details.
  14.  
  15.    You should have received a copy of the GNU General Public License
  16.    along with this program; if not, write to the Free Software
  17.    Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
  18. */
  19.  
  20. #define STEP    latin1_texte
  21. #include <stdio.h>
  22. #include "common.h"
  23.  
  24. static const char *translation_table[128] =
  25.   {
  26.     NULL,            /* \200 */
  27.     NULL,            /* \201 */
  28.     NULL,            /* \202 */
  29.     NULL,            /* \203 */
  30.     NULL,            /* \204 */
  31.     NULL,            /* \205 */
  32.     NULL,            /* \206 */
  33.     NULL,            /* \207 */
  34.     NULL,            /* \210 */
  35.     NULL,            /* \211 */
  36.     NULL,            /* \212 */
  37.     NULL,            /* \213 */
  38.     NULL,            /* \214 */
  39.     NULL,            /* \215 */
  40.     NULL,            /* \216 */
  41.     NULL,            /* \217 */
  42.     NULL,            /* \220 */
  43.     NULL,            /* \221 */
  44.     NULL,            /* \222 */
  45.     NULL,            /* \223 */
  46.     NULL,            /* \224 */
  47.     NULL,            /* \225 */
  48.     NULL,            /* \226 */
  49.     NULL,            /* \227 */
  50.     NULL,            /* \230 */
  51.     NULL,            /* \231 */
  52.     NULL,            /* \232 */
  53.     NULL,            /* \233 */
  54.     NULL,            /* \234 */
  55.     NULL,            /* \235 */
  56.     NULL,            /* \236 */
  57.     NULL,            /* \237 */
  58.  
  59.     " ",            /* \240 no-break space */
  60.     NULL,            /* \241 inverted exclamation mark */
  61.     NULL,            /* \242 cent sign */
  62.     NULL,            /* \243 pound sign */
  63.     NULL,            /* \244 currency sign */
  64.     NULL,            /* \245 yen sign */
  65.     NULL,            /* \246 broken bar */
  66.     NULL,            /* \247 paragraph sign, section sign */
  67.     NULL,            /* \250 diaeresis */
  68.     NULL,            /* \251 copyright sign */
  69.     NULL,            /* \252 feminine ordinal indicator */
  70.     "``",            /* \253 left angle quotation mark */
  71.     NULL,            /* \254 not sign */
  72.     NULL,            /* \255 soft hyphen */
  73.     NULL,            /* \256 registered trade mark sign */
  74.     NULL,            /* \257 macron */
  75.     NULL,            /* \260 degree sign */
  76.     NULL,            /* \261 plus-minus sign */
  77.     NULL,            /* \262 superscript two */
  78.     NULL,            /* \263 superscript three */
  79.     NULL,            /* \264 acute accent */
  80.     NULL,            /* \265 small greek mu, micro sign */
  81.     NULL,            /* \266 pilcrow sign */
  82.     NULL,            /* \267 middle dot */
  83.     NULL,            /* \270 cedilla */
  84.     NULL,            /* \271 superscript one */
  85.     NULL,            /* \272 masculine ordinal indicator */
  86.     "''",            /* \273 right angle quotation mark */
  87.     NULL,            /* \274 vulgar fraction one quarter */
  88.     NULL,            /* \275 vulgar fraction one half */
  89.     NULL,            /* \276 vulgar fraction three quarters */
  90.     NULL,            /* \277 inverted question mark */
  91.     "A`",            /* \300 capital A with grave accent */
  92.     NULL,            /* \301 capital A with acute accent */
  93.     "A^",            /* \302 capital A with circumflex accent */
  94.     NULL,            /* \303 capital A with tilde */
  95.     "A\"",            /* \304 capital A diaeresis */
  96.     NULL,            /* \305 capital A with ring above */
  97.     NULL,            /* \306 capital diphthong A with E */
  98.     "C,",            /* \307 capital C with cedilla */
  99.     "E`",            /* \310 capital E with grave accent */
  100.     "E\'",            /* \311 capital E with acute accent */
  101.     "E^",            /* \312 capital E with circumflex accent */
  102.     "E\"",            /* \313 capital E with diaeresis */
  103.     NULL,            /* \314 capital I with grave accent */
  104.     NULL,            /* \315 capital I with acute accent */
  105.     "I^",            /* \316 capital I with circumflex accent */
  106.     "I\"",            /* \317 capital I with diaeresis */
  107.     NULL,            /* \320 capital icelandic ETH */
  108.     NULL,            /* \321 capital N with tilde */
  109.     "O`",            /* \322 capital O with grave accent */
  110.     NULL,            /* \323 capital O with acute accent */
  111.     "O^",            /* \324 capital O with circumflex accent */
  112.     NULL,            /* \325 capital O with tilde */
  113.     "O\"",            /* \326 capital O with diaeresis */
  114.     NULL,            /* \327 multiplication sign */
  115.     NULL,            /* \330 capital O with oblique stroke */
  116.     "U`",            /* \331 capital U with grave accent */
  117.     NULL,            /* \332 capital U with acute accent */
  118.     "U^",            /* \333 capital U with circumflex accent */
  119.     "U\"",            /* \334 capital U with diaeresis */
  120.     NULL,            /* \335 capital Y with acute accent */
  121.     NULL,            /* \336 capital icelandic THORN */
  122.     NULL,            /* \337 small german sharp s */
  123.     "a`",            /* \340 small a with grave accent */
  124.     NULL,            /* \341 small a with acute accent */
  125.     "a^",            /* \342 small a with circumflex accent */
  126.     NULL,            /* \343 small a with tilde */
  127.     "a\"",            /* \344 small a with diaeresis */
  128.     NULL,            /* \345 small a with ring above */
  129.     NULL,            /* \346 small diphthong a with e */
  130.     "c,",            /* \347 small c with cedilla */
  131.     "e`",            /* \350 small e with grave accent */
  132.     "e\'",            /* \351 small e with acute accent */
  133.     "e^",            /* \352 small e with circumflex accent */
  134.     "e\"",            /* \353 small e with diaeresis */
  135.     NULL,            /* \354 small i with grave accent */
  136.     NULL,            /* \355 small i with acute accent */
  137.     "i^",            /* \356 small i with circumflex accent */
  138.     "i\"",            /* \357 small i with diaeresis */
  139.     NULL,            /* \360 small icelandic eth */
  140.     NULL,            /* \361 small n with tilde */
  141.     "o`",            /* \362 small o with grave accent */
  142.     NULL,            /* \363 small o with acute accent */
  143.     "o^",            /* \364 small o with circumflex accent */
  144.     NULL,            /* \365 small o with tilde */
  145.     "o\"",            /* \366 small o with diaeresis */
  146.     NULL,            /* \367 division sign */
  147.     NULL,            /* \370 small o with oblique stroke */
  148.     "u`",            /* \371 small u with grave accent */
  149.     NULL,            /* \372 small u with acute accent */
  150.     "u^",            /* \373 small u with circumflex accent */
  151.     "u\"",            /* \374 small u with diaeresis */
  152.     NULL,            /* \375 small y with acute accent */
  153.     NULL,            /* \376 small icelandic thorn */
  154.     NULL,            /* \377 small y with diaeresis */
  155.   };
  156.  
  157. void
  158. STEP (FILE *input_file, FILE *output_file)
  159. {
  160.   int input_char;        /* current character */
  161.   const char *output_string;    /* translated characters */
  162.  
  163.   while (input_char = getc (input_file), input_char != EOF)
  164.     if ((input_char & 0377) < 0200)
  165.       putc (input_char, output_file);
  166.     else
  167.       if (output_string = translation_table[input_char & 0177], output_string)
  168.     while (*output_string)
  169.       {
  170.         putc (*output_string, output_file);
  171.         output_string++;
  172.       }
  173. }
  174.